<?php 
	include('function/connection.php');
	if(isset($_GET['billNumber'])){	
		$billNumber = $_GET['billNumber'];
		$query = "SELECT DISTINCT stock_id, pd_date, sup_name, amount, paid, balance, billnumber FROM tbl_stocks WHERE billnumber = '$billNumber'";
		$result = mysql_query($query);
      	$row = mysql_fetch_array($result);	
		$bill = $row['billnumber'];
		$date = $row['pd_date'];
		$amount = $row['amount'];
		$paid = $row['paid'];
		$balance = $row['balance'];
		$sup_id = $row['sup_name'];
		$now = date('Y-m-d');
		$action = "pending";
	}
		
?>

<form action="verify_oustanding.php?action=<?php echo $action; ?>&bill=<?php echo $bill; ?>" method="post" class="form" name="form1" id="form1">
	<table class="bordered" width="770">
        <thead>
            <tr>
                <th>Add Stock Sales Payment:<br /><span class="red">* require feild</span></th>
            </tr>
        </thead>
	</table>
    <table class="bordered" width="770">
		<tr>
        	<td>
            	<label>Bill:</label>
            </td> 
			<td>
				<input type="text" class="txtPending" name="txtBill" value="<?php echo $bill; ?>" readonly="" /> 
            </td>           
		</tr>
        <tr>
        	<td>
        		<label>Date:</label>
            </td>
        	<td>
            	<input type="text" class="txtPending" name="txtDate" value="<?php echo $date; ?>" readonly="" /> 
            </td>
        </tr>
        <tr>
        	<td>
        		<label>Pending Date:</label>
            </td>
        	<td>
            	<input type="text" class="txtPending" name="txtPendingDate" id="from_sales_date" value="<?php echo $now ?>" /> 
            </td>
        </tr>
        <tr>
       		<td>
            	<label>Supplier:</label>
           	</td>
        	<td>
				<input type="text" class="txtPending" name="txtSupplier" value="<?php echo $sup_id; ?>" readonly="" />
           	</td>
		</tr>
        <tr>
        	<td>
            	<label>Amount:</label>
            </td>
			<td>
				<input type="text" class="txtPending" name="txtAmount" value="<?php echo $amount; ?>" readonly="" />
            </td>
        <tr>
       		<td>
            	<label>Paid:</label>
            </td>
            <td>
            	<input type="text" class="txtPending" name="txtPaid" value="<?php echo $paid; ?>" readonly="" />
            </td>
		</tr>
        <tr>
       		<td>
            	<label>Balance:</label>
            </td>
            <td>
            	<input type="text" class="txtPending" id="balance" name="txtBalance" value="<?php echo $balance; ?>" readonly="" />
            </td>
		</tr>
        <tr>
       		<td>
            	<label><span class="red">*</span>New Payment:</label>
            </td>
            <td>
                <input name="txtNewPay" type="text" id="newpayment" value=""  class="input req-min" minlength="1" onKeyUp="balanceCalc()" />
            </td>
		</tr>
		<tr>
			<td colspan="4"><input type="submit" class="btnSubmit" name="payNow" id="Submit"  value="Pay Now" />&nbsp; 
            <input type="button" class="btnSubmit" name="btnSubmit" value="Cancel" onclick="redirect('index.php?page=pending_list&action=pending_list')" /></td>
		</tr>
	</table>
</form>